package net.lab0.fractal.gui;


import javax.swing.JPanel;
import java.awt.GridBagLayout;
import javax.swing.JLabel;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.text.DecimalFormat;


@SuppressWarnings("serial")
public class StatusPanel
extends JPanel
{
	private JLabel			lblXYLabel;
	private JLabel			lblXY;
	private DecimalFormat	decimalFormat;
	
	/**
	 * Create the panel.
	 */
	public StatusPanel()
	{
		decimalFormat = new DecimalFormat("0.##############################");
		initComponents();
	}
	
	private void initComponents()
	{
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[] { 0, 150, 0, 0, 0 };
		gridBagLayout.rowHeights = new int[] { 0, 0 };
		gridBagLayout.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
		gridBagLayout.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
		setLayout(gridBagLayout);
		
		lblXYLabel = new JLabel("(x,y)");
		GridBagConstraints gbc_lblXYLabel = new GridBagConstraints();
		gbc_lblXYLabel.insets = new Insets(0, 0, 0, 5);
		gbc_lblXYLabel.gridx = 0;
		gbc_lblXYLabel.gridy = 0;
		add(lblXYLabel, gbc_lblXYLabel);
		
		lblXY = new JLabel("(...,...)");
		GridBagConstraints gbc_lblXY = new GridBagConstraints();
		gbc_lblXY.insets = new Insets(0, 0, 0, 5);
		gbc_lblXY.gridx = 1;
		gbc_lblXY.gridy = 0;
		add(lblXY, gbc_lblXY);
	}
	
	public void setCoordinates(java.awt.geom.Point2D.Double point)
	{
		lblXY.setText("(" + decimalFormat.format(point.x) + ";" + decimalFormat.format(point.y) + ")");
	}
	
}
